$(function(){
	$(".listbox li").click(function(){
		$(this).css("border-top", "5px solid red").siblings().css("border-top", "5px solid white");
	});
	
	
	
$.ajax({
	type:"get",
	url:"../data/dataPro.json",
	async:true,
	success:function(mpros){
		url = window.location.href;
		url = url.split("?");
		url = url[1].split("=");
		count = url[1];
		count1 = parseInt(count);
//		console.log(count);  //详情页传过来的数量,然后根据cookie中的数据,分别修改信息
		str = getCookie("car");
		
//		console.log(str);//cookie中取出的是一个字符串
		arr = JSON.parse( str );//转化为数组对象
//		console.log( arr[0].id ); // 传过来的id
		id = arr[0].id;
		price = arr[0].price;
		dis = arr[0].dis;
		src = arr[0].src;
		$(".propic").attr("src"," " +  src + " ");
		$(".fsjia").html( price );
		$(".jizhi").html( count );
		$("#xiaoji").html( price );
		prices = parseInt(price.substr(1));   //取出价格
		$(".jz").html( price );
	
	$(".car").click(function(){
		$(".wodecar").find("span").html("我的购物车");
		$(".boxcar").html(' <div class="goucarPro"><table><tr class="list"><td>  </td><td> <span class="pro">商品</span> </td><td> <span class="jai">风尚价</span>  </td><td>  <select><option>江西 南昌市</option><option>江西 南昌市</option><option>江西 南昌市</option></select></td><td> <span class="shu">数量</span> </td><td> <span class="jine">金额小计</span> </td><td>  </td></tr><tr><td> <img class="propic" src="../fstvgo/201603151101128316493-1.png.jpg" alt="" title="" /> </td><td class="dd"> <h3>床单一套喵姐品牌特惠</h3><p>商品编号:<span>308168</span>颜色:<span>兰花色</span>规格:<span> 共同</span></p></td><td class="fsjia">¥666</td><td class="youhuo"> 有货 </td><td class="countShu"><input type="number" value="'+count1+'"min="1" max="666"/></td><td> ¥<span id="xiaoji">666</span> </td><td class="caozuo"> <span class="colBlu">收藏</span><span class="colRed">删除</span></td></tr><tr class="qingkong"><td>清空购物车</td><td></td><td></td><td></td><td>总计:</td><td></td><td> ¥: <span>666</span> </td></tr><tr class="zhekou"><td></td><td></td><td></td><td></td><td>折扣:</td><td></td><td> -¥: <span>0</span> </td></tr><tr class="huojifen"><td>您可获积分:<span>0</span></td><td></td><td></td><td></td><td>总计(不记运费):</td><td></td><td> ¥: <span>666</span> </td></tr></table></div><div class="cunxiao"><p style="font-weight: bolder; font-size: 15px;">当前促销活动:</p><p class="dianjihuangou">99元可以换购GNC红酒葡萄籽精华胶囊2瓶 <input type="button" value="点击换购" /> </p></div><div class="jiesuan qujiesuang"><input type="button" name="" value="继续购物" class="gouwu"/><input type="button" name="" value="去结算 > " class="qujiesuang" /><p>填写送货地址 积分抵扣优惠卷使用请点击  → </p></div></div> ');
		$(".propic").attr("src"," " +  src + " ");
		$(".fsjia").html( price );
//		$(".jizhi").html( count );
		$("#xiaoji").html( price );
		prices = parseInt(price.substr(1));   //取出价格
		$(".jz").html( price );
	});
	$(".gouwu").click(function(){
		window.location.href = "../index.html";
	})
	$(".hedui,.qujiesuang").click(function(){
		$(".wodecar").find("span").html("核对信息");
		$(".boxcar").html(' <h3>收货信息</h3><dl><dt style="width: 800px; line-height: 30px;">使用新地址</dt><dd></dd><dt> <span>*</span>收货人: </dt><dd> <input type="text" name="" placeholder="收货人姓名" /><input type="radio" name="sex" />先生  <input type="radio" name="sex"/>女士</dd><dt> <span>*</span>所在区域: </dt> <dd class="difang"> <input type="text" name="" placeholder="省" /><input type="text" name="" placeholder="市" /><input type="text" name="" placeholder="区" /></dd><dt><span>*</span>详细地址: </dt> <dd> <input type="text" name="" placeholder="详细地址" /></dd><dt><span>*</span>手机号码: </dt> <dd> <input type="text" name="" placeholder="手机号码" /></dd><dt><span>*</span>邮政编码: </dt> <dd> <input type="text" name="" placeholder="邮政编码" /></dd><dt> <input type="button" value="确认信息" name="" class="queren"/> </dt><dd> <input type="button" value="取消" name="" class="quxiao" /> </dd></dl><div class="fkfs"><h3>付款方式</h3><p style="background-color: #ffefd8; padding-left: 150px; line-height: 30px; margin-bottom: 20px;">请点击收货信息以确定支付方式!</p></div><div class="fkfs"><h3>收货方式</h3><p style="padding-left: 150px; line-height: 30px; margin-bottom: 20px;">请点击收货信息以确定收货方式!</p></div><div class="fkfs"><h3>发票抬头</h3><input type="text" placeholder="个人" style="margin-left: 150px; line-height: 30px; margin-bottom: 20px;" /></div><div><h3>商品信息</h3><table><tr class="list"><td>  </td><td> <span class="pro">商品</span> </td><td> <span class="jai">风尚价</span>  </td><td>  库存</td><td> <span class="shu">数量</span> </td><td> <span class="jine">金额小计</span> </td><td>  </td></tr><tr><td> <img class="propic" src="'+ src+'" alt="" title="" /> </td><td class="dd"><h3>'+ dis +'</h3><p>商品编号:<span>308168</span>颜色:<span>兰花色</span>规格:<span> 共同</span></p></td><td class="fsjia"> ' +price+ ' </td><td class="youhuo"> 有货 </td><td class="countShu"><span class="jizhi">  '+ count +'  </span></td><td> ¥<span id="xiaoji">' + price + '</span> </td><td class="caozuo"> </td></table></div><div class="yyh"><p>使用优惠卷抵扣订单金额</p><div>可用优惠卷:</div> </div><div class="yyh"><p>使用礼金卷抵扣订单金额</p><div>可用礼金卷:</div> </div><div class="yyh"><p>使用积分抵扣订单金额</p><div>可用积分:</div> </div><div class="yyh"><p>订单备注</p> <textarea ></textarea> </div><div class="zongji"><p>商品总价: <span>'+price+'</span> </p><p>促销优惠: <span>0</span> </p><p>积分抵扣: <span>0</span> </p><p>优惠抵扣: <span>0</span> </p><p>礼金抵扣: <span>0</span> </p><p>支付优惠: <span>0</span> </p><p>运费金额: <span>0</span> </p></div><div class="tjdingdan"><button class="quetj">提交订单</button><p>可获积分: <span> 0 </span> </p><p>订单总计: <span>'+ price +'</span> </p></div></div> ');
	});
$(".quetj").click(function(){
//	alert(2222);//找不到提交按钮
})
	$(".tijiao,.quetj").click(function(){
		$(".wodecar").find("span").html("提交订单");
		$(".boxcar").html(' <img src="../img/wenzitu.jpg" alt="" title="" style="margin-top: 5px;"/><div class="xinxi"><p>订单号: <span>2012540</span>货到付款:<span>666</span>风尚快递  </p><p>收货信息: <span>安吉</span><span>北京</span> <span>18825412513</span></p><p>您的订单已经进入系统(我的订单)。</p></div><div class="spxx"><table><tr class="list"><td>  </td><td> <span class="pro">商品</span> </td><td> <span class="jai">风尚价</span>  </td><td>  库存</td><td> <span class="shu">数量</span> </td><td> <span class="jine">金额小计</span> </td><td>  </td></tr><tr><td> <img class="propic" src="'+ src +'" alt="" title="" /> </td><td class="dd"><h3>'+dis+'</h3><p>商品编号:<span>308168</span>颜色:<span>兰花色</span>规格:<span> 共同</span></p></td><td class="fsjia"> '+price+' </td><td class="youhuo"> 有货 </td><td class="countShu"><span class="jizhi">  '+count+'  </span></td><td> ¥<span id="xiaoji">666</span> </td><td class="caozuo"> </td></table></div><div class="zongji"><p>商品总价: <span>666</span> </p><p>促销优惠: <span>0</span> </p><p>积分抵扣: <span>0</span> </p><p>优惠抵扣: <span>0</span> </p><p>礼金抵扣: <span>0</span> </p><p>支付优惠: <span>0</span> </p><p>运费金额: <span>0</span> </p></div><div class="tjdingdan"><button class="tishile">确认订单</button><p>可获积分: <span> 0 </span> </p><p>订单总计: <span>'+price+'</span> </p></div> ');
	})


$(".tishile").click(function(){
	alert("订单已经成功!");
})

//获取数据的结尾标签
	}
});	

})
























